<?php
namespace app\servergoods\model;

use \app\manage\model\BaseModel;
// 商品分类模型层
class GoodsCategoryAttrs extends BaseModel
{
	protected $name = 'goods_category_attrs';
    protected $connection = 'db_config_goods';
    protected $autoWriteTimestamp = true;
    protected $dateFormat = 'Y-m-d';
    protected $statusText = [0=>'禁用', 1=>'正常'];
    protected $isFilterText = [0=>'否', 1=>'是'];
    protected $showPositionText = ['main'=>'主', 'secondary'=>'次'];
    protected $searchFlagText = ['number'=>'库存', 'none'=>'无'];
    protected $isShowText = ['0'=>'否', '1'=>'是'];
    protected $attrTypeText = [1=>'文本', 2=>'多行文本', 3=>'单选', 4 =>'多选', 5=>'下拉', 6=>'文件'];
    protected $append = ['status_text','is_filter_text','show_position_text','search_flag_text','is_show_text','attr_type_text'];

    public function getStatusTextAttr($value,$data)
    {
    	return $this->statusText[$data['status']];
    }

    public function getIsFilterTextAttr($value,$data)
    {
    	return $this->isFilterText[$data['is_filter']];
    }

    public function getShowPositionTextAttr($value,$data)
    {
    	return $this->showPositionText[$data['show_position']];
    }

    public function getSearchFlagTextAttr($value,$data)
    {
    	return $this->searchFlagText[$data['search_flag']];
    }

    public function getIsShowTextAttr($value,$data)
    {
    	return $this->isShowText[$data['is_show']];
    }
    
    public function getAttrTypeTextAttr($value,$data)
    {
    	return $this->attrTypeText[$data['attr_type']];
    }
}
